//
// Created by 张闳 on 2021/12/13.
//

#include <list.h>
#include <logger.h>

struct people {
    uint64_t id;
    char name[20];
    uint8_t age;
};

int main(int argc, char* argv[]){
    log_init();
    log_set_level(LOG_DEBUG);
    mlist_t mylist;
    mylist = list_new();
    list_add(mylist,"test value",10);
    struct people person={.id=10001,
            .name= "Bill Gates",
            .age=23,
    };
    list_add(mylist,&person,sizeof(person));
    uint16_t intd = 123;
    list_add(mylist,&intd,2);
    char *v1 = (char *)list_get(mylist,0);
    struct people *p = (struct people *)list_get(mylist,1);
    uint16_t *v2 = (uint16_t *)list_get(mylist,2);
    logDebug("key1 = %s, person.name = %s, person.age = %d, test.int = %u",v1,p->name,p->age,*v2);
    list_free(mylist);
}